package site.wuao.simplerxjava.base;

import rx.Observable;
import rx.Subscriber;

/**
 * 被观察者
 *
 * @author wuao
 * @date 2017/11/10
 * @github {https://github.com/CoderWuao}
 * @blogs {http://wuao.site/}
 * @note -
 * ---------------------------------------------------------------------------------------------------------------------
 * @modified -
 * @date -
 * @github -
 * @blogs -
 * @note -
 */
public class RxObservable {
    /**
     * 创建被观察者 - create
     */
    private void createObservableByCreate() {
        Observable<String> observable = Observable.create(new Observable.OnSubscribe<String>() {

            @Override
            public void call(Subscriber<? super String> subscriber) {
                // subscriber 就是观察者
            }
        });
    }

    /**
     * 创建被观察者 - just
     */
    private void createObservableByJust() {
        Observable<Integer> observable = Observable.just(1, 2, 3);
    }

    /**
     * 创建被观察者 - from
     */
    private void createObservableByFrom() {
        Observable<Integer> observable = Observable.from(new Integer[]{1, 2, 3});
    }
}
